﻿using UnityEngine;
using System.Collections;

public class ShotSpeedUp : MonoBehaviour {

    public bool affectsEnergyShots = true;
    public bool affectsTeleportShots = true;
    public bool affectsMissiles = true;

    public int maxIncreases = int.MaxValue;
    private int currentIncreases = 0;

    public float speedAdjustment = 1.5f;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

    void OnTriggerEnter(Collider collider)
    {
        if (currentIncreases >= maxIncreases) return;

        bool doAdjustment = false;

        switch (collider.tag)
        {
            case "teleportShot":
                doAdjustment = affectsTeleportShots;
                break;
            case "energyShot":
                doAdjustment = affectsEnergyShots;
                break;
            case "missile":
                doAdjustment = affectsMissiles;
                break;
        }

        if (doAdjustment)
        {
            collider.GetComponent<LateSpeedAdjust>().SetAdjustment(speedAdjustment);
            currentIncreases++;
        }


    }
}
